package service;

import java.util.List;

import util.StringUtil;
import dao.UserDao;
import entity.User;

public class UserService {
	private UserDao userdao=new UserDao();
	
	public User login(String name,String password,String pic){
		User user=userdao.findByUserName(name);
		
		if(user!=null&&user.getPassword().equals(StringUtil.sha1(password))){
			user.setPic(pic);
			
			return user;
			
		}
		return null;
	}

	public User findByname(String item) {
		
		return userdao.findByUserName(item);
		
	}

	public List<User> findAll() {
		
		return userdao.findAll();
	}
	
}
